#include "git-cert-request.h"

#include <git2/credential.h>

namespace git
{

CertRequest::CertRequest(const char *url, const char *usernameFromUrl, int allowedTypes) {
    if (url) {
        url_ = url;
    }
    if (usernameFromUrl) {
        usernameFromUrl_ = usernameFromUrl;
    }
    allowedTypes_ = allowedTypes;
}

bool CertRequest::allowUserpass() const {
    return (allowedTypes_ & GIT_CREDENTIAL_USERPASS_PLAINTEXT) != 0;
}

bool CertRequest::allowSsh() const {
    return (allowedTypes_ & GIT_CREDENTIAL_SSH_KEY) != 0;
}


} // namespace git
